<template>
  <el-tooltip effect="dark" popper-class="padding-10-15">
    <template #content>
      <ul class="tips-box">
        <li><span @click="copySymbol('${user.fullId}')">${user.fullId}</span>：字段类型为“联动”，联动类型为“人员树”时，当前登录人取值</li>
        <li><span @click="copySymbol('${user.attrName}')">${user.attrName}</span>：当前登录人(attrName为属性名)</li>
        <li><span @click="copySymbol('${org.attrName}')">${org.attrName}</span>：当前登录部门(attrName为属性名)</li>
        <li><span @click="copySymbol('${script.code}')">${script.code}</span>：code为运行的脚本编码，脚本返回内容：字符串/数字</li>
        <li><span @click="copySymbol('${date.currYear}')">${date.currYear}</span>：当前年份：2024</li>
        <li><span @click="copySymbol('${date.currMonth}')">${date.currMonth}</span>：当前月份：1</li>
        <li><span @click="copySymbol('${date.currDay}')">${date.currDay}</span>：当前日期：31</li>
        <li><span @click="copySymbol('${date.currDate}')">${date.currDate}</span>：当前年月日：2024-01-31</li>
        <li><span @click="copySymbol('${date.currMonthFirst}')">${date.currMonthFirst}</span>：当前月第1日：2024-01-01</li>
        <li><span @click="copySymbol('${date.currTime}')">${date.currTime}</span>：当前时间</li>
        <li><span @click="copySymbol('${date.first7Day}')">${date.first7Day}</span>：前7天日期：2024-01-25</li>
        <li><span @click="copySymbol('${date.first30Day}')">${date.first30Day}</span>：前30天日期：2024-01-02</li>
      </ul>
    </template>
    <ac-icon iconId="018dca8ec9890493be26" />
  </el-tooltip>
</template>

<script setup>
import clipboard from 'clipboard';
import { ElMessage } from "element-plus";

const emit = defineEmits(['change']);
const copySymbol = (symbol) => {
  emit('change', symbol);

  clipboard.copy(symbol);
  ElMessage.success("已复制到剪贴板");
};
</script>

<style scoped>
.tips-box li {
  font-size: 15px;
  display: flex;
  flex-direction: row;
  align-items: center;
  > span {
    cursor: pointer;
    display: inline-block!important;
  }
}
</style>